package org.example.test.test;


/**
 * 给你一棵二叉树的根节点 root ，翻转这棵二叉树，并返回其根节点。
 */
public class InvertTree {

    public static void main(String[] args) {

    }

    public static TreeNode invertTree(TreeNode root) {
        if (root == null){
            return null;
        }else {
            TreeNode treeNode = root.right;
            root.right = root.left;
            root.left = treeNode;
            invertTree(root.left);
            invertTree(root.right);
            return root;
        }

    }
}
